package top.hkyzf.study.leetcode.math;

import org.junit.Test;

/**
 * @author 朱峰
 * @date 2022-1-25 11:10
 */
public class 比赛中的配对次数_1688 {
    public int numberOfMatches(int n) {
        int result = 0;
        while (n > 1) {
            result = result + n / 2;
            n = n / 2 + n % 2;
        }
        return result;
    }



    @Test
    public void testNumberOfMatches () {
        int n = 29;
        System.out.println(numberOfMatches(n));
    }
}
